速報APP / 工具 / Qr code generator - 2019

Qr code generator - 2019

價格:免費

更新日期:2019-03-23

檔案大小:5.2M

目前版本:2.0

版本需求:Android 4.4 以上版本

官方網站:mailto:shrisivacomputers@gmail.com

Email:https://techliveupdate.blogspot.com/p/privacy-policy.html

聯絡地址:TAMILNADU, INDIA

Qr code generator - 2019(圖1)-速報App

Qr code generator - 2019

What our application consists of:

Home Screen Widget for user to select scan QR Code or generate QR Code.

QR Code Scanner Widget for user to scan QR code with device camera and view the text result of the QR code.

QR Code Generator Widget for user to enter text data and generate QR Code Widget, convert widget to image file, and share image file to other application.

Project Dependencies

Our project pubspec.yaml file plugin dependencies consists of:

dependencies: ....path_provider: 0.4.1barcode_scan: ^0.0.4qr_flutter: ^1.1.1

path_provider by Flutter Team. A Flutter plugin for finding commonly used locations on the filesystem. Supports iOS and Android.

barcode_scan by Matthew. A Flutter plugin for scanning 2D barcodes and QR codes as a wrapper using specific iOS mikebuss/MTBBarcodeScanner and Android dm77/barcodescanner library.

qr_flutter by Luke Freeman. QR.Flutter is a QR code generation and rendering library for Flutter.

Qr code generator - 2019(圖2)-速報App

Home Screen Widget

Our app home screen widget allow the user to select whether to perform scan or generate QR Code by tapping on button. The build widget return a Column with 2 RaisedButton as the children, one for routing to generating QR code screen and one for routing to scanning QR code screen when the button is tapped.

Scan Screen QR Code Widget

The scan screen widget display the start scan with camera button and a Text widget that display the result of the camera QR code scan. It uses the Column Widget as the parent for the Text and Button children.

When user taps on Button, the async scan function is invoked. It will use the BarcodeScanner class from the barcode_scanner plugin dependencies to start the camera viewfinder both on iOS and Android for user to point and scan the QR Code.

If QR code is found, the result of the text will be returned and will be assigned to the barcode instance variable inside the setState function that will trigger widget render. The barcode instance variable will be assigned to Text Widget to display the result of the QR Code scan. If Error occurs, we just set the barcode property with the error message.

Generate Screen QR Code Widget

The Generate screen widget displays a TextField for user enter the text data that will be used to generate the QR Code widget using the qr_flutter plugin when the user tap on the submit Button. It also provides a Share Button in the Navigation bar to share the image png file to other apps in iOS and Android.

When user has filled the TextField and tap on the submit button, we assign the _dataString property value inside the setState method that will trigger widget render. Our Widget will pass the _dataString property to the QrImage widget that will process the text and render the qr using custom qr painter. We wrap the QrImage inside the RepaintBoundary widget with a GlobalKey property so we can get the RenderRepaintBoundary later with the key and use the built in Flutter to Image method on the RenderRepaintBoundary widget that will convert the widget to a png file.

Generate QR Code PNG Image and Sharing with Platform Specific Channel

When user taps on the sharing button we invoke the _captureAndSharePng function that will get the RepaintBoundary object with GlobalKey passed to RepaintBoundary widget. Then we call the toImage method that will convert the widget to Image object and convert the Image object using toByteData with png format.

After that we get the bytes data, get the application temporary directory and save the data inside the temporary directory. To share the image, we will use platform specific channel API method that will pass the image path and call shareImage on each platform for iOS and Android.

This Description Generated By www.articlegenerator.org